﻿namespace PocketE6B.Engine
{
    using System;

    /// <summary>
    /// This class provides supplemental mathematics operations
    /// not provided by the base Math library.
    /// </summary>
    public static class Trig
    {
        /// <summary>
        /// Calculates a coterminal angle to the value provided which
        /// exists between -2PI and 2PI.
        /// </summary>
        /// <param name="angle">The angle to evaluate</param>
        /// <returns>An angle between -2PI and 2PI</returns>
        public static double NormalizeAngle(double angle)
        {
            return angle % 360;
        }

        /// <summary>
        /// Converts degree values to radian values.
        /// </summary>
        /// <param name="degrees">The angle in degrees.</param>
        /// <returns>The angle in radians.</returns>
        public static double DegreesToRadians(double degrees)
        {
            return (Math.PI / 180) * degrees;
        }

        /// <summary>
        /// Converts radian values to degree values.
        /// </summary>
        /// <param name="radians">The angle in radians.</param>
        /// <returns>The angle in degrees.</returns>
        public static double RadiansToDegrees(double radians)
        {
            return (180 / Math.PI) * radians;
        }
    }
}
